package com.egg.auth.enums.job;


import com.egg.common.swagger.annotation.SwaggerDisplayAnnotation;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 岗位编码枚举类
 *
 * @author east
 */
@Getter
@SwaggerDisplayAnnotation
@AllArgsConstructor
public enum JobAuthCodeEnum {


    CEO("董事长", "ceo" ),
    SE("项目经理", "se" ),
    HR("人力资源", "hr" ),
    STAFF("普通员工", "staff" ),
    ;


    private String message;
    private String code;

    public static boolean isInvalid(String code) {
        if (null == code) {
            return true;
        }
        return !Arrays.stream(values()).anyMatch(o -> Objects.equals(code, o.getCode()));
    }

    @Override
    public String toString() {
        return message + ":" + code;
    }
}
